package labox.innovation.gameserver.idfactory;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Logger;

import labox.innovation.config.Config;
import labox.innovation.db.core.L2DatabaseFactory;

/**
 * This class ...
 *
 * @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $
 */

public class CompactionIDFactory extends IdFactory {

	private int _curOID;

	private int _freeSize;

	protected CompactionIDFactory() {
		super();
		_curOID = FIRST_OID;
		_freeSize = 0;
	}

	@Override
	public synchronized int getNextId() {
		/*if (_freeSize == 0)*/return _curOID++;
		/* else
		 return _freeOIDs[--_freeSize];*/
	}

	@Override
	public synchronized void releaseId(int id) {
		//dont release ids until we are sure it isnt messing up
		/* if (_freeSize >= _freeOIDs.length)
		 {
		 int[] tmp = new int[_freeSize + STACK_SIZE_INCREMENT];
		 System.arraycopy(_freeOIDs, 0, tmp, 0, _freeSize);
		 _freeOIDs = tmp;
		 }
		 _freeOIDs[_freeSize++] = id;*/
	}

	@Override
	public int size() {
		return _freeSize + LAST_OID - FIRST_OID;
	}

	/* (non-Javadoc)
	 * @see labox.innovation.gameserver.idfactory.IdFactory#getNextId(int)
	 */
	@Override
	public long getNextId(int type) {
		// TODO Auto-generated method stub
		return 0;
	}
}
